home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DJGPP / CBGRX103.ZIP / contrib / libgrx / drivers / vesainfo.asm < prev    next >
Assembly Source File  |  1993-12-06  |  18KB  |  1,103 lines

  1.     ifndef    ??version
  2. ?debug    macro
  3.     endm
  4. $comm    macro    name,dist,size,count
  5.     comm    dist name:BYTE:count*size
  6.     endm
  7.     else
  8. $comm    macro    name,dist,size,count
  9.     comm    dist name[size]:BYTE:count
  10.     endm
  11.     endif
  12.     ?debug    S "vesainfo.c"
  13.     ?debug    C E99AA4BE1A0A76657361696E666F2E63
  14.     ?debug    C E920083A151B433A5C42494E5C5443435C494E434C5544455C7374+
  15.     ?debug    C 646C69622E68
  16.     ?debug    C E920083A151A433A5C42494E5C5443435C494E434C5544455C7374+
  17.     ?debug    C 64696F2E68
  18.     ?debug    C E920083A1518433A5C42494E5C5443435C494E434C5544455C646F+
  19.     ?debug    C 732E68
  20. _TEXT    segment byte public 'CODE'
  21. _TEXT    ends
  22. DGROUP    group    _DATA,_BSS
  23.     assume    cs:_TEXT,ds:DGROUP
  24. _DATA    segment word public 'DATA'
  25. d@    label    byte
  26. d@w    label    word
  27. _DATA    ends
  28. _BSS    segment word public 'BSS'
  29. b@    label    byte
  30. b@w    label    word
  31. _BSS    ends
  32. _TEXT    segment byte public 'CODE'
  33.    ;    
  34.    ;    int getinfo(VgaInfoBlock *vgainfo)
  35.    ;    
  36.     assume    cs:_TEXT
  37. _getinfo    proc    near
  38.     push    bp
  39.     mov    bp,sp
  40.     push    si
  41.     push    di
  42.     mov    si,word ptr [bp+4]
  43.    ;    
  44.    ;    {
  45.    ;        _ES = FP_SEG(vgainfo);
  46.    ;    
  47.     mov    ax,ds
  48.     mov    es,ax
  49.    ;    
  50.    ;        _DI = FP_OFF(vgainfo);
  51.    ;    
  52.     mov    di,si
  53.    ;    
  54.    ;        _AX = VESA_FUNC + VESA_VGA_INFO;
  55.    ;    
  56.     mov    ax,20224
  57.    ;    
  58.    ;        geninterrupt(0x10);
  59.    ;    
  60.     int    16
  61.    ;    
  62.    ;        if(_AX != VESA_SUCCESS) return(0);
  63.    ;    
  64.     cmp    ax,79
  65.     je    short @1@74
  66.     xor    ax,ax
  67.     jmp    short @1@290
  68. @1@74:
  69.    ;    
  70.    ;        if(vgainfo->VESASignature[0] != 'V') return(0);
  71.    ;    
  72.     cmp    byte ptr [si],86
  73.     je    short @1@122
  74.     xor    ax,ax
  75.     jmp    short @1@290
  76. @1@122:
  77.    ;    
  78.    ;        if(vgainfo->VESASignature[1] != 'E') return(0);
  79.    ;    
  80.     cmp    byte ptr [si+1],69
  81.     je    short @1@170
  82.     xor    ax,ax
  83.     jmp    short @1@290
  84. @1@170:
  85.    ;    
  86.    ;        if(vgainfo->VESASignature[2] != 'S') return(0);
  87.    ;    
  88.     cmp    byte ptr [si+2],83
  89.     je    short @1@218
  90.     xor    ax,ax
  91.     jmp    short @1@290
  92. @1@218:
  93.    ;    
  94.    ;        if(vgainfo->VESASignature[3] != 'A') return(0);
  95.    ;    
  96.     cmp    byte ptr [si+3],65
  97.     je    short @1@266
  98.     xor    ax,ax
  99.     jmp    short @1@290
  100. @1@266:
  101.    ;    
  102.    ;        return(1);
  103.    ;    
  104.     mov    ax,1
  105.     jmp    short @1@290
  106. @1@290:
  107.    ;    
  108.    ;    }
  109.    ;    
  110.     pop    di
  111.     pop    si
  112.     pop    bp
  113.     ret    
  114. _getinfo    endp
  115.    ;    
  116.    ;    int getmodeinfo(int mode,ModeInfoBlock *modeinfo)
  117.    ;    
  118.     assume    cs:_TEXT
  119. _getmodeinfo    proc    near
  120.     push    bp
  121.     mov    bp,sp
  122.     push    si
  123.     push    di
  124.     mov    si,word ptr [bp+6]
  125.    ;    
  126.    ;    {
  127.    ;        _ES = FP_SEG(modeinfo);
  128.    ;    
  129.     mov    ax,ds
  130.     mov    es,ax
  131.    ;    
  132.    ;        _DI = FP_OFF(modeinfo);
  133.    ;    
  134.     mov    di,si
  135.    ;    
  136.    ;        _CX = mode;
  137.    ;    
  138.     mov    cx,word ptr [bp+4]
  139.    ;    
  140.    ;        _AX = VESA_FUNC + VESA_MODE_INFO;
  141.    ;    
  142.     mov    ax,20225
  143.    ;    
  144.    ;        geninterrupt(0x10);
  145.    ;    
  146.     int    16
  147.    ;    
  148.    ;        if(_AX != VESA_SUCCESS) return(0);
  149.    ;    
  150.     cmp    ax,79
  151.     je    short @2@74
  152.     xor    ax,ax
  153.     jmp    short @2@98
  154. @2@74:
  155.    ;    
  156.    ;        return(modeinfo->ModeAttributes & MODE_SUPPORTED);
  157.    ;    
  158.     mov    ax,word ptr [si]
  159.     and    ax,1
  160.     jmp    short @2@98
  161. @2@98:
  162.    ;    
  163.    ;    }
  164.    ;    
  165.     pop    di
  166.     pop    si
  167.     pop    bp
  168.     ret    
  169. _getmodeinfo    endp
  170.    ;    
  171.    ;    void printinfo(VgaInfoBlock *vgainfo)
  172.    ;    
  173.     assume    cs:_TEXT
  174. _printinfo    proc    near
  175.     push    bp
  176.     mov    bp,sp
  177.     sub    sp,8
  178.     push    si
  179.     mov    si,word ptr [bp+4]
  180.    ;    
  181.    ;    {
  182.    ;        char  far *sp = vgainfo->OEMStringPtr;
  183.    ;    
  184.     mov    ax,word ptr [si+8]
  185.     mov    dx,word ptr [si+6]
  186.     mov    word ptr [bp-4],dx
  187.     mov    word ptr [bp-2],ax
  188.    ;    
  189.    ;        short far *mp = vgainfo->VideoModePtr;
  190.    ;    
  191.     mov    ax,word ptr [si+16]
  192.     mov    dx,word ptr [si+14]
  193.     mov    word ptr [bp-8],dx
  194.     mov    word ptr [bp-6],ax
  195.    ;    
  196.    ;    
  197.    ;        printf("VESASignature: \"%c%c%c%c\"\n",
  198.    ;    
  199.    ;    
  200.    ;            vgainfo->VESASignature[0],
  201.    ;            vgainfo->VESASignature[1],
  202.    ;            vgainfo->VESASignature[2],
  203.    ;            vgainfo->VESASignature[3]
  204.    ;        );
  205.    ;    
  206.     mov    al,byte ptr [si+3]
  207.     cbw    
  208.     push    ax
  209.     mov    al,byte ptr [si+2]
  210.     cbw    
  211.     push    ax
  212.     mov    al,byte ptr [si+1]
  213.     cbw    
  214.     push    ax
  215.     mov    al,byte ptr [si]
  216.     cbw    
  217.     push    ax
  218.     mov    ax,offset DGROUP:s@
  219.     push    ax
  220.     call    near ptr _printf
  221.     add    sp,10
  222.    ;    
  223.    ;        printf("VESAVersion:\t%d.%d\n",
  224.    ;    
  225.    ;    
  226.    ;            ((vgainfo->VESAVersion >> 8) & 0xff),
  227.    ;            (vgainfo->VESAVersion & 0xff)
  228.    ;        );
  229.    ;    
  230.     mov    ax,word ptr [si+4]
  231.     and    ax,255
  232.     push    ax
  233.     mov    ax,word ptr [si+4]
  234.     mov    cl,8
  235.     sar    ax,cl
  236.     and    ax,255
  237.     push    ax
  238.     mov    ax,offset DGROUP:s@+27
  239.     push    ax
  240.     call    near ptr _printf
  241.     add    sp,6
  242.    ;    
  243.    ;        printf("OEMStringPtr:\t\"");
  244.    ;    
  245.     mov    ax,offset DGROUP:s@+47
  246.     push    ax
  247.     call    near ptr _printf
  248.     pop    cx
  249.     jmp    short @3@122
  250. @3@50:
  251.    ;    
  252.    ;        while(*sp != '\0') putchar(*sp++);
  253.    ;    
  254.     mov    ax,word ptr DGROUP:__streams+16
  255.     inc    ax
  256.     mov    word ptr DGROUP:__streams+16,ax
  257.     or    ax,ax
  258.     jge    short @3@98
  259.     les    bx,dword ptr [bp-4]
  260.     inc    word ptr [bp-4]
  261.     mov    al,byte ptr es:[bx]
  262.     mov    bx,word ptr DGROUP:__streams+26
  263.     inc    word ptr DGROUP:__streams+26
  264.     mov    byte ptr [bx],al
  265.     mov    ah,0
  266.     jmp    short @3@122
  267. @3@98:
  268.     mov    ax,offset DGROUP:__streams+16
  269.     push    ax
  270.     les    bx,dword ptr [bp-4]
  271.     inc    word ptr [bp-4]
  272.     mov    al,byte ptr es:[bx]
  273.     push    ax
  274.     call    near ptr __fputc
  275.     pop    cx
  276.     pop    cx
  277. @3@122:
  278.     les    bx,dword ptr [bp-4]
  279.     cmp    byte ptr es:[bx],0
  280.     jne    short @3@50
  281.    ;    
  282.    ;        printf("\"\nCapabilities:\t%ld\n",vgainfo->Capabilities);
  283.    ;    
  284.     push    word ptr [si+12]
  285.     push    word ptr [si+10]
  286.     mov    ax,offset DGROUP:s@+63
  287.     push    ax
  288.     call    near ptr _printf
  289.     add    sp,6
  290.    ;    
  291.    ;        printf("VideoModePtr:\t%Fp\n",mp);
  292.    ;    
  293.     push    word ptr [bp-6]
  294.     push    word ptr [bp-8]
  295.     mov    ax,offset DGROUP:s@+84
  296.     push    ax
  297.     call    near ptr _printf
  298.     add    sp,6
  299.    ;    
  300.    ;        printf("Video Modes:\t");
  301.    ;    
  302.     mov    ax,offset DGROUP:s@+103
  303.     push    ax
  304.     call    near ptr _printf
  305.     pop    cx
  306.     jmp    short @3@194
  307. @3@170:
  308.    ;    
  309.    ;        while(*mp != (-1)) printf("0x%x ",*mp++);
  310.    ;    
  311.     les    bx,dword ptr [bp-8]
  312.     add    word ptr [bp-8],2
  313.     push    word ptr es:[bx]
  314.     mov    ax,offset DGROUP:s@+117
  315.     push    ax
  316.     call    near ptr _printf
  317.     pop    cx
  318.     pop    cx
  319. @3@194:
  320.     les    bx,dword ptr [bp-8]
  321.     cmp    word ptr es:[bx],65535
  322.     jne    short @3@170
  323.    ;    
  324.    ;        printf("\n\n");
  325.    ;    
  326.     mov    ax,offset DGROUP:s@+123
  327.     push    ax
  328.     call    near ptr _printf
  329.     pop    cx
  330.    ;    
  331.    ;    }
  332.    ;    
  333.     pop    si
  334.     mov    sp,bp
  335.     pop    bp
  336.     ret    
  337. _printinfo    endp
  338. _TEXT    ends
  339. _DATA    segment word public 'DATA'
  340. _modeattrbits    label    word
  341.     db    1
  342.     db    0
  343.     dw    DGROUP:s@+126
  344.     db    2
  345.     db    0
  346.     dw    DGROUP:s@+141
  347.     db    4
  348.     db    0
  349.     dw    DGROUP:s@+154
  350.     db    8
  351.     db    0
  352.     dw    DGROUP:s@+167
  353.     db    16
  354.     db    0
  355.     dw    DGROUP:s@+180
  356.     db    0
  357.     db    0
  358.     db    2 dup (0)
  359. _winattrbits    label    word
  360.     db    1
  361.     db    0
  362.     dw    DGROUP:s@+196
  363.     db    2
  364.     db    0
  365.     dw    DGROUP:s@+210
  366.     db    4
  367.     db    0
  368.     dw    DGROUP:s@+223
  369.     db    0
  370.     db    0
  371.     db    2 dup (0)
  372. _memorymodels    label    word
  373.     db    0
  374.     db    0
  375.     dw    DGROUP:s@+236
  376.     db    1
  377.     db    0
  378.     dw    DGROUP:s@+247
  379.     db    2
  380.     db    0
  381.     dw    DGROUP:s@+257
  382.     db    3
  383.     db    0
  384.     dw    DGROUP:s@+268
  385.     db    4
  386.     db    0
  387.     dw    DGROUP:s@+281
  388.     db    5
  389.     db    0
  390.     dw    DGROUP:s@+294
  391.     db    6
  392.     db    0
  393.     dw    DGROUP:s@+307
  394.     db    0
  395.     db    0
  396.     db    2 dup (0)
  397. _DATA    ends
  398. _TEXT    segment byte public 'CODE'
  399.    ;    
  400.    ;    void printbits(int value,bitdef *def)
  401.    ;    
  402.     assume    cs:_TEXT
  403. _printbits    proc    near
  404.     push    bp
  405.     mov    bp,sp
  406.     push    si
  407.     push    di
  408.     mov    si,word ptr [bp+6]
  409.    ;    
  410.    ;    {
  411.    ;        int prev = 0;
  412.    ;    
  413.     xor    di,di
  414.     jmp    short @4@170
  415. @4@50:
  416.    ;    
  417.    ;    
  418.    ;        while(def->bit != 0) {
  419.    ;            if(value & def->bit) {
  420.    ;    
  421.     mov    ax,word ptr [bp+4]
  422.     test    word ptr [si],ax
  423.     je    short @4@146
  424.    ;    
  425.    ;            if(prev) printf(" | ");
  426.    ;    
  427.     or    di,di
  428.     je    short @4@122
  429.     mov    ax,offset DGROUP:s@+320
  430.     push    ax
  431.     call    near ptr _printf
  432.     pop    cx
  433. @4@122:
  434.    ;    
  435.    ;            printf(def->name);
  436.    ;    
  437.     push    word ptr [si+2]
  438.     call    near ptr _printf
  439.     pop    cx
  440.    ;    
  441.    ;            prev = 1;
  442.    ;    
  443.     mov    di,1
  444. @4@146:
  445.    ;    
  446.    ;            }
  447.    ;            def++;
  448.    ;    
  449.     add    si,4
  450. @4@170:
  451.     cmp    word ptr [si],0
  452.     jne    short @4@50
  453.    ;    
  454.    ;        }
  455.    ;        if(!prev) printf("0");
  456.    ;    
  457.     or    di,di
  458.     jne    short @4@242
  459.     mov    ax,offset DGROUP:s@+324
  460.     push    ax
  461.     call    near ptr _printf
  462.     pop    cx
  463. @4@242:
  464.    ;    
  465.    ;        printf("\n");
  466.    ;    
  467.     mov    ax,offset DGROUP:s@+326
  468.     push    ax
  469.     call    near ptr _printf
  470.     pop    cx
  471.    ;    
  472.    ;    }
  473.    ;    
  474.     pop    di
  475.     pop    si
  476.     pop    bp
  477.     ret    
  478. _printbits    endp
  479. _TEXT    ends
  480. _BSS    segment word public 'BSS'
  481.     db    50 dup (?)
  482. _BSS    ends
  483. _TEXT    segment byte public 'CODE'
  484.    ;    
  485.    ;    char *getmodelname(int model)
  486.    ;    
  487.     assume    cs:_TEXT
  488. _getmodelname    proc    near
  489.     push    bp
  490.     mov    bp,sp
  491.     push    si
  492.     mov    si,word ptr [bp+4]
  493.    ;    
  494.    ;    {
  495.    ;        static char temp[50];
  496.    ;    
  497.    ;        if(model < 0) return(sprintf(temp,"Invalid model [%d]",model),temp);
  498.    ;    
  499.     or    si,si
  500.     jge    short @5@74
  501.     push    si
  502.     mov    ax,offset DGROUP:s@+328
  503.     push    ax
  504.     mov    ax,offset DGROUP:b@+0
  505.     push    ax
  506.     call    near ptr _sprintf
  507.     add    sp,6
  508.     mov    ax,offset DGROUP:b@+0
  509.     jmp    short @5@194
  510. @5@74:
  511.    ;    
  512.    ;        if(model <= MODEL_256_NC) return(memorymodels[model].name);
  513.    ;    
  514.     cmp    si,5
  515.     jg    short @5@122
  516.     mov    bx,si
  517.     shl    bx,1
  518.     shl    bx,1
  519.     mov    ax,word ptr DGROUP:_memorymodels[bx+2]
  520.     jmp    short @5@194
  521. @5@122:
  522.    ;    
  523.    ;        if(model <= 15) return(sprintf(temp,"VESA model [%0x2x]",model),temp);
  524.    ;    
  525.     cmp    si,15
  526.     jg    short @5@170
  527.     push    si
  528.     mov    ax,offset DGROUP:s@+347
  529.     push    ax
  530.     mov    ax,offset DGROUP:b@+0
  531.     push    ax
  532.     call    near ptr _sprintf
  533.     add    sp,6
  534.     mov    ax,offset DGROUP:b@+0
  535.     jmp    short @5@194
  536. @5@170:
  537.    ;    
  538.    ;        return(sprintf(temp,"OEM model [%0x2x]",model),temp);
  539.    ;    
  540.     push    si
  541.     mov    ax,offset DGROUP:s@+366
  542.     push    ax
  543.     mov    ax,offset DGROUP:b@+0
  544.     push    ax
  545.     call    near ptr _sprintf
  546.     add    sp,6
  547.     mov    ax,offset DGROUP:b@+0
  548.     jmp    short @5@194
  549. @5@194:
  550.    ;    
  551.    ;    }
  552.    ;    
  553.     pop    si
  554.     pop    bp
  555.     ret    
  556. _getmodelname    endp
  557.    ;    
  558.    ;    void printmodeinfo(int mode,ModeInfoBlock *modeinfo)
  559.    ;    
  560.     assume    cs:_TEXT
  561. _printmodeinfo    proc    near
  562.     push    bp
  563.     mov    bp,sp
  564.     push    si
  565.     mov    si,word ptr [bp+6]
  566.    ;    
  567.    ;    {
  568.    ;        printf("Mode 0x%x is supported\n",mode);
  569.    ;    
  570.     push    word ptr [bp+4]
  571.     mov    ax,offset DGROUP:s@+384
  572.     push    ax
  573.     call    near ptr _printf
  574.     pop    cx
  575.     pop    cx
  576.    ;    
  577.    ;        printf("  ModeAttributes:\t");
  578.    ;    
  579.     mov    ax,offset DGROUP:s@+408
  580.     push    ax
  581.     call    near ptr _printf
  582.     pop    cx
  583.    ;    
  584.    ;        printbits(modeinfo->ModeAttributes,modeattrbits);
  585.    ;    
  586.     mov    ax,offset DGROUP:_modeattrbits
  587.     push    ax
  588.     push    word ptr [si]
  589.     call    near ptr _printbits
  590.     pop    cx
  591.     pop    cx
  592.    ;    
  593.    ;        printf("  WinAAttributes:\t");
  594.    ;    
  595.     mov    ax,offset DGROUP:s@+427
  596.     push    ax
  597.     call    near ptr _printf
  598.     pop    cx
  599.    ;    
  600.    ;        printbits(modeinfo->WinAAttributes,winattrbits);
  601.    ;    
  602.     mov    ax,offset DGROUP:_winattrbits
  603.     push    ax
  604.     mov    al,byte ptr [si+2]
  605.     cbw    
  606.     push    ax
  607.     call    near ptr _printbits
  608.     pop    cx
  609.     pop    cx
  610.    ;    
  611.    ;        printf("  WinBAttributes:\t");
  612.    ;    
  613.     mov    ax,offset DGROUP:s@+446
  614.     push    ax
  615.     call    near ptr _printf
  616.     pop    cx
  617.    ;    
  618.    ;        printbits(modeinfo->WinBAttributes,winattrbits);
  619.    ;    
  620.     mov    ax,offset DGROUP:_winattrbits
  621.     push    ax
  622.     mov    al,byte ptr [si+3]
  623.     cbw    
  624.     push    ax
  625.     call    near ptr _printbits
  626.     pop    cx
  627.     pop    cx
  628.    ;    
  629.    ;        printf("  WinGranularity:\t%d\n",modeinfo->WinGranularity);
  630.    ;    
  631.     push    word ptr [si+4]
  632.     mov    ax,offset DGROUP:s@+465
  633.     push    ax
  634.     call    near ptr _printf
  635.     pop    cx
  636.     pop    cx
  637.    ;    
  638.    ;        printf("  WinSize:\t\t%d\n",modeinfo->WinSize);
  639.    ;    
  640.     push    word ptr [si+6]
  641.     mov    ax,offset DGROUP:s@+487
  642.     push    ax
  643.     call    near ptr _printf
  644.     pop    cx
  645.     pop    cx
  646.    ;    
  647.    ;        printf("  WinASegment:\t\t0x%04x\n",modeinfo->WinASegment);
  648.    ;    
  649.     push    word ptr [si+8]
  650.     mov    ax,offset DGROUP:s@+503
  651.     push    ax
  652.     call    near ptr _printf
  653.     pop    cx
  654.     pop    cx
  655.    ;    
  656.    ;        printf("  WinBSegment:\t\t0x%04x\n",modeinfo->WinBSegment);
  657.    ;    
  658.     push    word ptr [si+10]
  659.     mov    ax,offset DGROUP:s@+527
  660.     push    ax
  661.     call    near ptr _printf
  662.     pop    cx
  663.     pop    cx
  664.    ;    
  665.    ;        printf("  WinFuncPtr:\t\t\%Fp\n",modeinfo->WinFuncPtr);
  666.    ;    
  667.     push    word ptr [si+14]
  668.     push    word ptr [si+12]
  669.     mov    ax,offset DGROUP:s@+551
  670.     push    ax
  671.     call    near ptr _printf
  672.     add    sp,6
  673.    ;    
  674.    ;        printf("  BytesPerScanLine:\t%d\n",modeinfo->BytesPerScanLine);
  675.    ;    
  676.     push    word ptr [si+16]
  677.     mov    ax,offset DGROUP:s@+571
  678.     push    ax
  679.     call    near ptr _printf
  680.     pop    cx
  681.     pop    cx
  682.    ;    
  683.    ;        if(!(modeinfo->ModeAttributes & MODE_EXTINFO)) return;
  684.    ;    
  685.     test    word ptr [si],2
  686.     jne    short @6@74
  687.     jmp    @6@98
  688. @6@74:
  689.    ;    
  690.    ;        printf("  XResolution:\t\t%d\n",modeinfo->XResolution);
  691.    ;    
  692.     push    word ptr [si+18]
  693.     mov    ax,offset DGROUP:s@+595
  694.     push    ax
  695.     call    near ptr _printf
  696.     pop    cx
  697.     pop    cx
  698.    ;    
  699.    ;        printf("  YResolution:\t\t%d\n",modeinfo->YResolution);
  700.    ;    
  701.     push    word ptr [si+20]
  702.     mov    ax,offset DGROUP:s@+615
  703.     push    ax
  704.     call    near ptr _printf
  705.     pop    cx
  706.     pop    cx
  707.    ;    
  708.    ;        printf("  XCharSize:\t\t%d\n",modeinfo->XCharSize);
  709.    ;    
  710.     mov    al,byte ptr [si+22]
  711.     cbw    
  712.     push    ax
  713.     mov    ax,offset DGROUP:s@+635
  714.     push    ax
  715.     call    near ptr _printf
  716.     pop    cx
  717.     pop    cx
  718.    ;    
  719.    ;        printf("  YCharSize:\t\t%d\n",modeinfo->YCharSize);
  720.    ;    
  721.     mov    al,byte ptr [si+23]
  722.     cbw    
  723.     push    ax
  724.     mov    ax,offset DGROUP:s@+653
  725.     push    ax
  726.     call    near ptr _printf
  727.     pop    cx
  728.     pop    cx
  729.    ;    
  730.    ;        printf("  NumberOfPlanes:\t%d\n",modeinfo->NumberOfPlanes);
  731.    ;    
  732.     mov    al,byte ptr [si+24]
  733.     cbw    
  734.     push    ax
  735.     mov    ax,offset DGROUP:s@+671
  736.     push    ax
  737.     call    near ptr _printf
  738.     pop    cx
  739.     pop    cx
  740.    ;    
  741.    ;        printf("  BitsPerPixel:\t\t%d\n",modeinfo->BitsPerPixel);
  742.    ;    
  743.     mov    al,byte ptr [si+25]
  744.     cbw    
  745.     push    ax
  746.     mov    ax,offset DGROUP:s@+693
  747.     push    ax
  748.     call    near ptr _printf
  749.     pop    cx
  750.     pop    cx
  751.    ;    
  752.    ;        printf("  NumberOfBanks:\t%d\n",modeinfo->NumberOfBanks);
  753.    ;    
  754.     mov    al,byte ptr [si+26]
  755.     cbw    
  756.     push    ax
  757.     mov    ax,offset DGROUP:s@+714
  758.     push    ax
  759.     call    near ptr _printf
  760.     pop    cx
  761.     pop    cx
  762.    ;    
  763.    ;        printf("  MemoryModel:\t\t%d (%s)\n",modeinfo->MemoryModel,getmodelname(modeinfo->MemoryModel));
  764.    ;    
  765.     mov    al,byte ptr [si+27]
  766.     cbw    
  767.     push    ax
  768.     call    near ptr _getmodelname
  769.     pop    cx
  770.     push    ax
  771.     mov    al,byte ptr [si+27]
  772.     cbw    
  773.     push    ax
  774.     mov    ax,offset DGROUP:s@+735
  775.     push    ax
  776.     call    near ptr _printf
  777.     add    sp,6
  778.    ;    
  779.    ;        printf("  BankSize:\t\t%d\n",modeinfo->BankSize);
  780.    ;    
  781.     mov    al,byte ptr [si+28]
  782.     cbw    
  783.     push    ax
  784.     mov    ax,offset DGROUP:s@+760
  785.     push    ax
  786.     call    near ptr _printf
  787.     pop    cx
  788.     pop    cx
  789. @6@98:
  790.    ;    
  791.    ;    }
  792.    ;    
  793.     pop    si
  794.     pop    bp
  795.     ret    
  796. _printmodeinfo    endp
  797.    ;    
  798.    ;    void main(void)
  799.    ;    
  800.     assume    cs:_TEXT
  801. _main    proc    near
  802.     push    bp
  803.     mov    bp,sp
  804.     sub    sp,300
  805.     push    si
  806.    ;    
  807.    ;    {
  808.    ;        VgaInfoBlock  vgainfo;
  809.    ;        ModeInfoBlock modeinfo;
  810.    ;        short far *modeptr;
  811.    ;        int mode;
  812.    ;    
  813.    ;        if(getinfo(&vgainfo)) {
  814.    ;    
  815.     lea    ax,word ptr [bp-260]
  816.     push    ax
  817.     call    near ptr _getinfo
  818.     pop    cx
  819.     or    ax,ax
  820.     je    short @7@194
  821.    ;    
  822.    ;            printinfo(&vgainfo);
  823.    ;    
  824.     lea    ax,word ptr [bp-260]
  825.     push    ax
  826.     call    near ptr _printinfo
  827.     pop    cx
  828.    ;    
  829.    ;            modeptr = vgainfo.VideoModePtr;
  830.    ;    
  831.     mov    ax,word ptr [bp-244]
  832.     mov    dx,word ptr [bp-246]
  833.     mov    word ptr [bp-4],dx
  834.     mov    word ptr [bp-2],ax
  835.     jmp    short @7@146
  836. @7@74:
  837.    ;    
  838.    ;            while((mode = *modeptr++) != (-1)) {
  839.    ;            if(getmodeinfo(mode,&modeinfo)) printmodeinfo(mode,&modeinfo);
  840.    ;    
  841.     lea    ax,word ptr [bp-300]
  842.     push    ax
  843.     push    si
  844.     call    near ptr _getmodeinfo
  845.     pop    cx
  846.     pop    cx
  847.     or    ax,ax
  848.     je    short @7@122
  849.     lea    ax,word ptr [bp-300]
  850.     push    ax
  851.     push    si
  852.     call    near ptr _printmodeinfo
  853.     pop    cx
  854.     pop    cx
  855.     jmp    short @7@146
  856. @7@122:
  857.    ;    
  858.    ;            else printf("Mode 0x%x IS NOT SUPPORTED!\n",mode);
  859.    ;    
  860.     push    si
  861.     mov    ax,offset DGROUP:s@+777
  862.     push    ax
  863.     call    near ptr _printf
  864.     pop    cx
  865.     pop    cx
  866. @7@146:
  867.     les    bx,dword ptr [bp-4]
  868.     add    word ptr [bp-4],2
  869.     mov    ax,word ptr es:[bx]
  870.     mov    si,ax
  871.     cmp    ax,65535
  872.     jne    short @7@74
  873.    ;    
  874.    ;            }
  875.    ;        }
  876.    ;    
  877.     jmp    short @7@218
  878. @7@194:
  879.    ;    
  880.    ;        else printf("VESA BIOS extensions not found\n");
  881.    ;    
  882.     mov    ax,offset DGROUP:s@+806
  883.     push    ax
  884.     call    near ptr _printf
  885.     pop    cx
  886. @7@218:
  887.    ;    
  888.    ;        exit(0);
  889.    ;    
  890.     xor    ax,ax
  891.     push    ax
  892.     call    near ptr _exit
  893.     pop    cx
  894.    ;    
  895.    ;    }
  896.    ;    
  897.     pop    si
  898.     mov    sp,bp
  899.     pop    bp
  900.     ret    
  901. _main    endp
  902.     ?debug    C E9
  903. _TEXT    ends
  904. _DATA    segment word public 'DATA'
  905. s@    label    byte
  906.     db    'VESASignature: "%c%c%c%c"'
  907.     db    10
  908.     db    0
  909.     db    'VESAVersion:'
  910.     db    9
  911.     db    '%d.%d'
  912.     db    10
  913.     db    0
  914.     db    'OEMStringPtr:'
  915.     db    9
  916.     db    '"'
  917.     db    0
  918.     db    '"'
  919.     db    10
  920.     db    'Capabilities:'
  921.     db    9
  922.     db    '%ld'
  923.     db    10
  924.     db    0
  925.     db    'VideoModePtr:'
  926.     db    9
  927.     db    '%Fp'
  928.     db    10
  929.     db    0
  930.     db    'Video Modes:'
  931.     db    9
  932.     db    0
  933.     db    '0x%x '
  934.     db    0
  935.     db    10
  936.     db    10
  937.     db    0
  938.     db    'MODE_SUPPORTED'
  939.     db    0
  940.     db    'MODE_EXTINFO'
  941.     db    0
  942.     db    'MODE_SUPBIOS'
  943.     db    0
  944.     db    'MODE_ISCOLOR'
  945.     db    0
  946.     db    'MODE_ISGRAPHICS'
  947.     db    0
  948.     db    'WIN_SUPPORTED'
  949.     db    0
  950.     db    'WIN_READABLE'
  951.     db    0
  952.     db    'WIN_WRITABLE'
  953.     db    0
  954.     db    'MODEL_TEXT'
  955.     db    0
  956.     db    'MODEL_CGA'
  957.     db    0
  958.     db    'MODEL_HERC'
  959.     db    0
  960.     db    'MODEL_4PLANE'
  961.     db    0
  962.     db    'MODEL_PACKED'
  963.     db    0
  964.     db    'MODEL_256_NC'
  965.     db    0
  966.     db    'MODEL_DIRECT'
  967.     db    0
  968.     db    ' | '
  969.     db    0
  970.     db    '0'
  971.     db    0
  972.     db    10
  973.     db    0
  974.     db    'Invalid model [%d]'
  975.     db    0
  976.     db    'VESA model [%0x2x]'
  977.     db    0
  978.     db    'OEM model [%0x2x]'
  979.     db    0
  980.     db    'Mode 0x%x is supported'
  981.     db    10
  982.     db    0
  983.     db    '  ModeAttributes:'
  984.     db    9
  985.     db    0
  986.     db    '  WinAAttributes:'
  987.     db    9
  988.     db    0
  989.     db    '  WinBAttributes:'
  990.     db    9
  991.     db    0
  992.     db    '  WinGranularity:'
  993.     db    9
  994.     db    '%d'
  995.     db    10
  996.     db    0
  997.     db    '  WinSize:'
  998.     db    9
  999.     db    9
  1000.     db    '%d'
  1001.     db    10
  1002.     db    0
  1003.     db    '  WinASegment:'
  1004.     db    9
  1005.     db    9
  1006.     db    '0x%04x'
  1007.     db    10
  1008.     db    0
  1009.     db    '  WinBSegment:'
  1010.     db    9
  1011.     db    9
  1012.     db    '0x%04x'
  1013.     db    10
  1014.     db    0
  1015.     db    '  WinFuncPtr:'
  1016.     db    9
  1017.     db    9
  1018.     db    '%Fp'
  1019.     db    10
  1020.     db    0
  1021.     db    '  BytesPerScanLine:'
  1022.     db    9
  1023.     db    '%d'
  1024.     db    10
  1025.     db    0
  1026.     db    '  XResolution:'
  1027.     db    9
  1028.     db    9
  1029.     db    '%d'
  1030.     db    10
  1031.     db    0
  1032.     db    '  YResolution:'
  1033.     db    9
  1034.     db    9
  1035.     db    '%d'
  1036.     db    10
  1037.     db    0
  1038.     db    '  XCharSize:'
  1039.     db    9
  1040.     db    9
  1041.     db    '%d'
  1042.     db    10
  1043.     db    0
  1044.     db    '  YCharSize:'
  1045.     db    9
  1046.     db    9
  1047.     db    '%d'
  1048.     db    10
  1049.     db    0
  1050.     db    '  NumberOfPlanes:'
  1051.     db    9
  1052.     db    '%d'
  1053.     db    10
  1054.     db    0
  1055.     db    '  BitsPerPixel:'
  1056.     db    9
  1057.     db    9
  1058.     db    '%d'
  1059.     db    10
  1060.     db    0
  1061.     db    '  NumberOfBanks:'
  1062.     db    9
  1063.     db    '%d'
  1064.     db    10
  1065.     db    0
  1066.     db    '  MemoryModel:'
  1067.     db    9
  1068.     db    9
  1069.     db    '%d (%s)'
  1070.     db    10
  1071.     db    0
  1072.     db    '  BankSize:'
  1073.     db    9
  1074.     db    9
  1075.     db    '%d'
  1076.     db    10
  1077.     db    0
  1078.     db    'Mode 0x%x IS NOT SUPPORTED!'
  1079.     db    10
  1080.     db    0
  1081.     db    'VESA BIOS extensions not found'
  1082.     db    10
  1083.     db    0
  1084. _DATA    ends
  1085. _TEXT    segment byte public 'CODE'
  1086. _TEXT    ends
  1087.     public    _printinfo
  1088.     public    _winattrbits
  1089.     public    _getmodelname
  1090.     public    _memorymodels
  1091.     extrn    _printf:near
  1092.     extrn    __fputc:near
  1093.     public    _getmodeinfo
  1094.     public    _getinfo
  1095.     public    _modeattrbits
  1096.     extrn    _sprintf:near
  1097.     public    _main
  1098.     public    _printmodeinfo
  1099.     extrn    __streams:word
  1100.     extrn    _exit:near
  1101.     public    _printbits
  1102.     end
  1103.